/**
 * 提交按钮
 */
function main() {
    var self = this;
    console.log(self);

    var textFle = self.$$("text_input_9oznsd"); // 获取输入框元素
    var formPartEle = self.$$("form_part_6og3ws");
    let value = textFle.$$getValue();
    console.log(value); // 获取输入框的值

    api.DATA_SOURCE_EXECUTE("bd7c8e41-25cb-4abc-a104-e4021ded85f8", "ddcat", [], [], "").then(res => {
        console.log(res);
        let index = res.result.findIndex(item => item.name == value);
        if (index != -1) {
            console.log('存在姓名');
            console.log(self);
            let item = res.result[index];
            self.$ztDialog.confirm({
                title: '摊主' + item.name + '于' + item.create_time + '已上报',
                message: '是否继续创建？',
            }).then(() => {
                // on confirm
                if (formPartEle) {
                    formPartEle.$$getRenderElement().onSave().then((saveRes) => {
                        if (saveRes.result) {
                            self.$route.query.refresh = "1";
                            self.$router.back();
                        }
                    });
                }
            }).catch(() => {
                // on cancel
                return;
            });
        }else{
            if (formPartEle) {
                formPartEle.$$getRenderElement().onSave().then((saveRes) => {
                    if (saveRes.result) {
                        self.$route.query.refresh = "1";
                        self.$router.back();
                    }
                });
            }
        }
    }).catch(err => {
        console.error(err);
    });
}
